
var initFoodOrderItemInfoBean;
var getFoodOrderItemInfoBeanFromOpenPage = function(){
	var foodorderiteminfoBean = {};
	foodorderiteminfoBean.id = jQuery('#idEditor').val();
	
	foodorderiteminfoBean.orderId = jQuery('#orderIdEditor').val();
	if(!foodorderiteminfoBean.orderId){
		$.ligerDialog.error("请输入订餐号!");
		return null;
	}	foodorderiteminfoBean.time = jQuery('#timeEditor').val();
	if(!foodorderiteminfoBean.time){
		$.ligerDialog.error("请输入时间!");
		return null;
	}else{
		foodorderiteminfoBean.time = new Date(Date.parse((foodorderiteminfoBean.time+':00').replace(/-/g,   "/")));
	}
	foodorderiteminfoBean.state = jQuery('#stateEditor').val();
	if(!foodorderiteminfoBean.state){
		$.ligerDialog.error("请输入状态!");
		return null;
	}	foodorderiteminfoBean.desc = jQuery('#descEditor').val();
	
	return foodorderiteminfoBean;
};

var initFoodOrderItemInfoPage = function(){
	
	
	
	jQuery("#timeEditor").ligerDateEditor({
		format:'yyyy-MM-dd hh:mm:ss',
		showTime:true,
	});
	
	
};

var bindFoodOrderItemInfoUpdateButtom = function(){
	jQuery('#updateEdit').unbind('click').click(function(){
		var foodorderiteminfoBean = getFoodOrderItemInfoBeanFromOpenPage();
		if(null != foodorderiteminfoBean){
			doSaveFoodOrderItemInfos([foodorderiteminfoBean]);
		}
	});
};
var bindFoodOrderItemInfoResetButtom = function(){
	jQuery('#resetEdit').unbind('click').click(function(){
		if(!initFoodOrderItemInfoBean){
			jQuery("#orderIdEditor").val('');
			jQuery("#timeEditor").val('');
			jQuery("#stateEditor").val('');
			jQuery("#descEditor").val('');
		}else{
			if(!initFoodOrderItemInfoBean.orderId){
				jQuery("#orderIdEditor").val('');
			}else{
				jQuery("#orderIdEditor").val(initFoodOrderItemInfoBean.orderId);
			}
			if(!initFoodOrderItemInfoBean.time){
				jQuery("#timeEditor").val('');
			}else{
				var temp = new Date(initFoodOrderItemInfoBean.time);
				jQuery("#timeEditor").val(temp.formatLiger());
			}
			if(!initFoodOrderItemInfoBean.state){
				jQuery("#stateEditor").val('');
			}else{
				jQuery("#stateEditor").val(initFoodOrderItemInfoBean.state);
			}
			if(!initFoodOrderItemInfoBean.desc){
				jQuery("#descEditor").val('');
			}else{
				jQuery("#descEditor").val(initFoodOrderItemInfoBean.desc);
			}
		}
	});
};



jQuery(function(){
	initFoodOrderItemInfoPage();
	bindFoodOrderItemInfoUpdateButtom();
	bindFoodOrderItemInfoResetButtom();
});